#ifndef ALARMFORMV1_H
#define ALARMFORMV1_H

#include <QWidget>
#include <QtSql>

namespace Ui {
    class AlarmFormV1;
}

class AlarmFormV1 : public QWidget {
    Q_OBJECT

    struct AlarmStruct{
        QString strID;
        QDateTime dtAlarmDate;
    };

public:
    AlarmFormV1(QSqlDatabase _db,
                QWidget *parent = 0);
    ~AlarmFormV1();

protected:
    void changeEvent(QEvent *e);

private:
    Ui::AlarmFormV1 *ui;

//-----------------------------------------------------
public:
    void updateAlarms();//query db again

private:
    void initUIs();

private:
    QSqlDatabase m_SqlDB;

    QSqlTableModel* m_pAlarmRecoedModel;
    QSqlQueryModel* m_pAlarmQueryModel;

    QTimer* m_pTimer;

    QList<AlarmStruct> m_AlarmList;
    int m_AlarmIndex;

private slots:
    void checkAlarm();

};

#endif // ALARMFORMV1_H
